var Mongoose = require('mongoose');

var ideaKeywordSchema = Mongoose.Schema({
    keyword: [{
        Id: {type: Mongoose.Schema.ObjectId, ref: 'Keyword'},
        content: {type: String, required: true},
        count: {type: Number, default: 1}
    }],
    ideaId: {
        type: Mongoose.Schema.ObjectId,
        ref: 'Idea'
    }
}, {timestamps: true});

var IdeaKeyword = Mongoose.model('IdeaKeyword', ideaKeywordSchema);

IdeaKeyword.createIdeaKeyword = function (newIdeaKeyword, callback) {
    newIdeaKeyword.save(callback);
};

module.exports = IdeaKeyword;
